<style>
@media print {
  ._wz_postResponsibilityDetails {
    -webkit-print-color-adjust: exact;
    height: inherit !important;
    font-size: 12px !important;
  }
}
</style>
<template>
  <div class="_wz_postResponsibilityDetails" ref="postResponsibilityDetails">

    <table cellpadding="0" cellspacing="0" border="0">
      <colgroup>
        <col width="13%">
        <col width="20%">
        <col width="13%">
        <col width="20%">
        <col width="13%">
        <col width="20%">
      </colgroup>
      <tbody>
      <tr>
        <td style="font-weight: 600;position:relative;" colspan="6">
          岗位责任制度
          <Button type="primary" @click="printTest" class="no-print" style="position: absolute;right: 10px;top: 8px;">
            打印
          </Button>
        </td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;">运输企业</td>
        <td colspan="5">{{ !!formData.deptName ? formData.deptName : '--' }}</td>
      </tr>
      <tr>
        <td style="font-weight: 600;position:relative;" colspan="6">负责人责任制</td>
      </tr>
      <tr>
        <td colspan="2">
          <div class="demo-upload-list">
            <viewer style="width: 100%;height: 100%; display: flex;align-items: center;justify-content: center;">
              <img :src="!!postLeadingImg.url?postLeadingImg.url:'../../static/img/zwtpxd.png'" @error="public.imgDispose">
            </viewer>
          </div>
        </td>
        <td colspan="4">
          <div class="ql-snow">
            <div class="ql-editor" v-html="!!formData.postLeadingContent?formData.postLeadingContent:'--'"></div>
          </div>
        </td>
      </tr>
      <tr>
        <td style="font-weight: 600;position:relative;" colspan="6">管理人责任制</td>
      </tr>
      <tr>
        <td colspan="2">
          <div class="demo-upload-list">
            <viewer style="width: 100%;height: 100%; display: flex;align-items: center;justify-content: center;">
              <img :src="!!postManagerImg.url?postManagerImg.url:'../../static/img/zwtpxd.png'" @error="public.imgDispose">
            </viewer>
          </div>
        </td>
        <td colspan="4">
          <div class="ql-snow">
            <div class="ql-editor" v-html="!!formData.postManagerContent?formData.postManagerContent:'--'"></div>
          </div>
        </td>
      </tr>
      <tr>
        <td style="font-weight: 600;position:relative;" colspan="6">安全员责任制</td>
      </tr>
      <tr>
        <td colspan="2">
          <div class="demo-upload-list">
            <viewer style="width: 100%;height: 100%; display: flex;align-items: center;justify-content: center;">
              <img :src="!!postSafetyImg.url?postSafetyImg.url:'../../static/img/zwtpxd.png'" @error="public.imgDispose">
            </viewer>
          </div>
        </td>
        <td colspan="4">
          <div class="ql-snow">
            <div class="ql-editor" v-html="!!formData.postSafetyContent?formData.postSafetyContent:'--'"></div>
          </div>
        </td>
      </tr>
      <tr>
        <td style="font-weight: 600;position:relative;" colspan="6">驾驶员责任制</td>
      </tr>
      <tr>
        <td colspan="2">
          <div class="demo-upload-list">
            <viewer style="width: 100%;height: 100%; display: flex;align-items: center;justify-content: center;">
              <img :src="!!postDriverImg.url?postDriverImg.url:'../../static/img/zwtpxd.png'" @error="public.imgDispose">
            </viewer>
          </div>
        </td>
        <td colspan="4">
          <div class="ql-snow">
            <div class="ql-editor" v-html="!!formData.postDriverContent?formData.postDriverContent:'--'"></div>
          </div>
        </td>
      </tr>
      </tbody>
    </table>


    <Spin size="large" fix v-if="spinShow"></Spin>

  </div>
</template>
<script>

import 'quill/dist/quill.core.css';
import 'quill/dist/quill.snow.css';
import 'quill/dist/quill.bubble.css';

export default {
  props: ['selectData'],//接收来自父组件的数据
  data() {
    return {
      uploadProgress: 0,//文件上传进度
      riskCheckPhaseList: [],
      spinShow: false,//本页加载
      formData: {},

      postLeadingImg: {data: null, url: ''},//负责人岗位责任制
      postManagerImg: {data: null, url: ''},//管理人员岗位责任制
      postSafetyImg: {data: null, url: ''},//安全员岗位责任制
      postDriverImg: {data: null, url: ''},//驾驶员岗位责任制

    }
  },
  beforeCreate() {//beforeCreate创建前状态

  },
  created() {//created创建完毕状态

  },
  beforeMount() {//beforeMount挂载前状态   DOM 元素然后塞入页面的过程

  },
  mounted() {//mounted 挂载结束状态
    var that = this;
    if (!!that.selectData.id) {

      that.formData = that.selectData;
      //负责人岗位责任制
      that.postLeadingImg = {
        data: null,
        url: !!that.formData.postLeadingImg ? that.apiUrl.imgUrl + that.formData.postLeadingImg : ''
      };

      //管理人员岗位责任制
      that.postManagerImg = {
        data: null,
        url: !!that.formData.postManagerImg ? that.apiUrl.imgUrl + that.formData.postManagerImg : ''
      };

      //安全员岗位责任制
      that.postSafetyImg = {
        data: null,
        url: !!that.formData.postSafetyImg ? that.apiUrl.imgUrl + that.formData.postSafetyImg : ''
      };

      //驾驶员岗位责任制
      that.postDriverImg = {
        data: null,
        url: !!that.formData.postDriverImg ? that.apiUrl.imgUrl + that.formData.postDriverImg : ''
      };
    }

  },
  methods: {//执行的方法
    printTest() {
      this.$print(this.$refs.postResponsibilityDetails) // 使用
    },
  },
  watch: {//监听

  },
  beforeUpdate() {//beforeUpdate 更新前状态

  },
  updated() {//updated 更新完成状态

  },
  beforeDestroy() {//beforeDestroy 销毁前状态

  },
  destroyed() {//destroyed 销毁完成状态

  }
}
</script>
<style lang="less">
._wz_postResponsibilityDetails {
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;

  > table {
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 12px !important;

    td {
      min-width: 0;
      height: 40px;
      box-sizing: border-box;
      text-align: left;
      text-overflow: ellipsis;
      border: 1px solid #515a6e;
      padding: 0 10px;
      word-break: break-word;
    }
  }

  .demo-upload-list {
    margin: 5px auto;
    width: 195px;
    height: 140px;
    text-align: center;
    line-height: 140px;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    position: relative;
    box-shadow: 0 0 0 0;

    img {
      min-height: 30%;
      max-height: 90%;
      min-width: 30%;
      max-width: 90%;
      //width: 100%;
      //height: 100%;
    }
  }
}
</style>
